'use strict';

/**
 * admin model
 */
 module.exports = app => {
   const { STRING, INTEGER, TINYINT } = app.Sequelize;
   const Admin = app.model.define('admin', {
     id: { type: INTEGER, primaryKey: true, autoIncrement: true },
     name: STRING,
     password: INTEGER,
     status: TINYINT,
     role_id: INTEGER,
     create_person: STRING,
     update_person: STRING,
   },{
       freezeTableName: true,
       tableName: 'admin'
   });

   Admin.associate = function () {
     app.model.Admin.belongsTo(app.model.Role, { foreignKey: 'role_Id', targetKey: 'id' });
     //app.model.User.hasMany(app.model.Family, { foreignKey: 'userId', targetKey: 'id' });
   }
  
   return Admin;
 }
